package com.get_webpage_source_code;

import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * @ClassName: GetWebpageSourceCode
 * @Author: ZhangYue26
 * @Description: 获取一个网页的源码
 * @Date: 2020-08-24
 */
public class GetWebpageSourceCode {

    public static void main(String[] args) {
        try {
            URL url = new URL("https://blog.csdn.net/howard2005/article/details/79425120");
            BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
            String line;
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
            reader.close();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}



